﻿using System;
using System.Text;
using Portal.Core;
using System.Collections.ObjectModel;
using Portal.Exam.Bussiness;
using Portal.Exam.Model;
using System.Data;

namespace Portal.Exam.Render
{
    public class ExamSegmentSubPermission : PermissionModuleTemplate
    {
        public override string ServiceId
        {
            get
            {
                return "ExamSegmentSubPermission";
            }
        }

        public override string ServiceName
        {
            get
            {
                return "Phân quyền cho kỳ thi";
            }
        }

        public override Collection<PermissionItemListCls> GetPermissionItemLists(string SiteId)
        {
            Collection<PermissionItemListCls>
                PermissionItemLists = new Collection<PermissionItemListCls> { };

            DataTable dtExamSegment = new ExamSegmentBll().ReadingExamSegment(SiteId, "exam", 1, "");

            for (int iIndex = 0; iIndex < dtExamSegment.Rows.Count; iIndex++)
            {
                string ExamSegmentId = (string)dtExamSegment.Rows[iIndex]["ExamSegmentId"];
                string ExamSegmentName = (string)dtExamSegment.Rows[iIndex]["ExamSegmentName"];

                PermissionItemListCls OPermissionItemList = new PermissionItemListCls();
                OPermissionItemList.subject = ExamSegmentName;
                OPermissionItemList.id = ExamSegmentId;
                OPermissionItemList.ptc = ExamSegmentPermission.StaticId;
                PermissionItemLists.Add(OPermissionItemList);
            }
            return PermissionItemLists;
        }
    }
}
